package com.ymatou.iapi.productmanager.testcase;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.productmanager.parameter.BatchRemovePspProductListHandlerBean;
import com.ymatou.iapi.productmanager.service.BatchRemovePspProductListHandlerCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.utils.EnvSetup;
/**
*总线批量撤销买手的PSP商品
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_BatchRemovePspProductListHandler{
	private static BatchRemovePspProductListHandlerBean batchremovepspproductlisthandlerBean;
	private static BatchRemovePspProductListHandlerCall batchremovepspproductlisthandlerCall;
	private static int sellerId = Integer.parseInt(EnvSetup.getData("productsellerid"));
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("总线批量撤销买手的PSP商品");
	}

	@Before
	public void caseUp() {
		batchremovepspproductlisthandlerBean=new BatchRemovePspProductListHandlerBean();
		batchremovepspproductlisthandlerCall=new BatchRemovePspProductListHandlerCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(batchremovepspproductlisthandlerCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_BatchRemovePspProductListHandler_001() {
		Logger.start(true,"总线批量撤销买手的PSP商品");
		try {
			List<Integer> list = new ArrayList<Integer>(); 
			list.add(sellerId);
			batchremovepspproductlisthandlerBean.setSellerIDList(list);
			batchremovepspproductlisthandlerCall.setData(batchremovepspproductlisthandlerBean);
			batchremovepspproductlisthandlerCall.callService();	
			List<Map> map = new YmtProductsIWapper().getBatchUpdatePspProductStatus(sellerId);
			List<Map> map1 = new YmtProductsIWapper().getBatchUpdatePspProductStatus2(sellerId);
			for(int i = 0;i<map.size();i++){
				Logger.verifyEquals(false, map.get(i).get("IsPspProduct"), "验证ispsproduct");
			}
			for(int i = 0;i<map1.size();i++){
				Logger.verifyEquals(0, map1.get(i).get("CheckStatus"), "验证CheckStatus");
				Logger.verifyEquals(0, map1.get(i).get("PspStatus"), "验证PspStatus");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}